print("-----Welcome to the computer!-----")
print("||       Copyright:BESTI        ||")
import math
def sum(a,b):
    return a+b
def sub(a,b):
    return a-b
def mul(a,b):
    return a*b
def mod(a,b):
    return a%b
def div(a,b):
    while (True):
        if b == 0:
            b = eval(input("b can't be 0,please enter b again:"))
        else:
            break
    return a/b
def flo(a,b):
    while (True):
        if b == 0:
            b = eval(input("b can't be 0,please enter b again:"))
        else:
            break
    return a//b
def fac(a):
    return math.factorial(int(a))
def pow(a,b):
    return math.pow(a,b)
def log(a, b):
    return math.log(b,a)
def sin(a):
    return math.sin(math.radians(a))
def cos(a):
    return math.cos(math.radians(a))
def tan(a):
    return math.tan(math.radians(a))
def complex(a,b):
    complexOpera = input('Enter the operation of complex(+-*/)')
    if complexOpera == '+':
        print("a+b = ", a+b)
    elif complexOpera == "-":
        print("a-b = ",a-b)
    elif complexOpera == "*":
        print("a*b = ",a*b)
    elif complexOpera == "/":
        print("a/b = ",a/b)
        while (True):
            if b == 0:
                b = eval(input("b can't be 0,please enter b again:"))
            else:
                break
    else:
        print("Invalid operator, please try again!")


flag = True
while(flag):
    operate = input("Please enter the operator,you can choose from(+ - * / % flo fac pow log sin cos tan com):")
    a = eval(input("Please enter a:"))
    b = eval(input("Please enter b:"))
    if operate == "+":
        print("a+b = ", sum(a, b))
    elif operate == "-":
        print("a-b = ",sub(a,b))
    elif operate == "*":
        print("a*b = ",mul(a,b))
    elif operate == "/":
        print("a/b = ",div(a,b))
    elif operate == "%":
        print("a%b = ",mod(a,b))
    elif operate == "flo":
        print("flo(a,b)= ",flo(a,b))
    elif operate == "fac":
        print("fac(a)=",fac(a),"fac(b)=",fac(b))
    elif operate == "pow":
        print("pow(a,b) = ",pow(a,b))
    elif operate == 'log':
        print("log a b (logarithm of b with base a)= ",log(a, b))
    elif operate == 'sin':
        print("sin(a)=",sin(a),"sin(b)=",sin(b))
    elif operate == 'cos':
        print("cos(a)=",cos(a),"cos(b)=",cos(b))
    elif operate == 'tan':
        print("tan(a)=",tan(a),"cos(b)=",tan(b))
    elif operate == 'com':
        complex(a,b)
    else:
        print("Invalid operator, please try again!")

    flag = False if input("Do you want to continue?").lower() == 'n' else True

print("Thank you for your using!")